package com.book.bigwork.model;

import com.sun.istack.NotNull;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Size;

@Entity
@Table(name = "roles")
public class Roles {
    @NotNull
    @Size(max = 50)
    @Id
    @Column(length = 50)
    private String rolename;

    public String getRoleName() {
        return rolename;
    }

    public void setRoleName(String rolename) {
        this.rolename = rolename;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (!(obj instanceof Roles)) return false;

        Roles roles = (Roles) obj;
        return rolename.equals(roles.rolename);
    }

    @Override
    public int hashCode() {
        return rolename.hashCode();
    }

    @Override
    public String toString() {
        return "Roles{" +
                "name='" + rolename + '\'' +
                '}';
    }
}
